package org.duang.db;

public abstract class Connection {

	public static final String HOST_FIELD = "host";
	public static final String PORT_FIELD = "port";
	public static final String DATABASE_FIELD = "database";
	public static final String USERNAME_FIELD = "username";
	public static final String PASSWORD_FIELD = "password";
	public static final String REPLICASET_FIELD = "replicaset";
	public static final String URL_FIELD = "url";
	
	
	protected String host;
	protected int port;
	protected String database;			//连接的数据库名称
	protected String username;
	protected String password;
	protected String replicaset;		//副本集地址(集群时须设置)
	protected String url;						// 连接数据库URL，用在Mysql等数据库
	
	protected String getHost() {
		return host;
	}

	protected void setHost(String host) {
		this.host = host;
	}

	protected int getPort() {
		return port;
	}

	protected void setPort(int port) {
		this.port = port;
	}

	protected String getDatabase() {
		return database;
	}

	protected void setDatabase(String database) {
		this.database = database;
	}

	protected String getUsername() {
		return username;
	}

	protected void setUsername(String username) {
		this.username = username;
	}

	protected String getPassword() {
		return password;
	}

	protected void setPassword(String password) {
		this.password = password;
	}
	
	protected String getReplicaset() {
		return replicaset;
	}

	protected void setReplicaset(String replicaset) {
		this.replicaset = replicaset;
	}
	
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * 初始化数据库
	 */
	protected abstract void initDasebase();
	/**
	 * 初始化权限
	 */
	protected abstract void initAuth();

	
}
